<template>
    <div class="participant wrap-table">
        <el-form ref="form" :model="searchData" label-width="80px" class="clearfix flex-div" label-position="left">
            <el-form-item label="入组日期" class="pull-left item-right" style="width:350px">
                <div class="block">
                    <el-date-picker
                            v-model="timeDate"
                            type="daterange"
                            align="right"
                            unlink-panels
                            range-separator="至"
                            value-format="yyyy-MM-dd"
                            :default-value="defaultValue"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            :picker-options="pickerOptions">
                    </el-date-picker>
                </div>
            </el-form-item>

            <el-form-item label="入组时研究阶段" label-width="120px" class="item-right" style="width:200px">
                <el-select v-model="searchData.inPeriod" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options2spyd"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>

            <el-form-item label="当前研究阶段" label-width="110px" class=" item-right" style="width:200px">
                <el-select v-model="searchData.period" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options2sp"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <!--<el-form-item label="所在地区" class="pull-left item-right" style="width:280px">-->
                <!--<el-cascader :clearable="true" class="zd-community-cascader" v-model="searchData.DistrictFullNo" :change-on-select="false" @active-item-change="handleItemChange" :options="optionDis">-->
                <!--</el-cascader>-->
            <!--</el-form-item>-->
            <el-form-item label="入组所在地区" class=" item-right" label-width="110px" style="width:220px">
                <el-select v-model="searchData.InDistrictNo" placeholder="请选择" @change="InchangeDis"  clearable :disabled="JSON.parse(UserDic).IsCommunityOnly=='1'">
                    <el-option
                            v-for="item in optionDiq"
                            :key="item.DistrictName"
                            :label="item.DistrictName"
                            :value="item.DistrictNo">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="入组所在社区" class=" item-right" label-width="110px" style="width:180px">
                <el-select v-model="InCtyIds" placeholder="请选择" @change="InCommutysp" clearable  :disabled="JSON.parse(UserDic).IsCommunityOnly=='1'">
                    <el-option
                            v-for="item in Inoptions1"
                            :key="item.SYS_ID"
                            :label="item.CName"
                            :value="item">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="当前所在地区" class=" item-right" label-width="110px" style="width:220px">
                <el-select v-model="searchData.districtNo" placeholder="请选择" @change="changeDis"  clearable :disabled="JSON.parse(UserDic).IsCommunityOnly=='1'">
                    <el-option
                            v-for="item in optionDiq"
                            :key="item.DistrictName"
                            :label="item.DistrictName"
                            :value="item.DistrictNo">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="当前所在社区" class=" item-right" label-width="110px" style="width:180px">
                <el-select v-model="CtyIds" placeholder="请选择" @change="Commutysp" clearable  :disabled="JSON.parse(UserDic).IsCommunityOnly=='1'">
                    <el-option
                            v-for="item in options1"
                            :key="item.SYS_ID"
                            :label="item.CName"
                            :value="item">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="研究组别" class=" item-right" style="width:160px">
                <el-select v-model="searchData.groupType" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options3"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="入组时干预强度" label-width="120px" class=" item-right" style="width:200px">
                <el-select v-model="searchData.inIntensityOfIntervention" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options4"
                            :key="item.value"
                            :disabled="RoleGroup==5"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="产前干预强度" label-width="100px" class=" item-right" style="width:190px">
                <el-select v-model="searchData.intensityOfIntervention" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options4"
                            :key="item.value"
                            :disabled="RoleGroup==5"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="当前儿童干预强度" label-width="140px" class=" item-right" style="width:220px">
                <el-select v-model="searchData.childIntensityOfIntervention" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options4"
                            :key="item.value"
                            :disabled="RoleGroup==5"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="分娩日期" class="pull-left item-right" style="width:350px">
                <div class="block">
                    <el-date-picker
                            v-model="BirthtimeDate"
                            type="daterange"
                            align="right"
                            unlink-panels
                            range-separator="至"
                            value-format="yyyy-MM-dd"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            :picker-options="pickerOptions">
                    </el-date-picker>
                </div>
            </el-form-item>
            <el-form-item label="试验类型" class=" item-right" style="width:240px">
                <el-select v-model="searchData.testType" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options6"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="对象状态" class=" item-right" style="width:180px">
                <el-select v-model="searchData.userState" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options5"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="预产期超42周" label-width="120px" class=" item-right" style="width:200px">
                <el-select v-model="searchData.isOver42" clearable placeholder="请选择">
                    <el-option value="1" label="是"></el-option>
                    <el-option value="0" label="否"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item class="item-right" style="width:310px;margin-left: -60px" label="">
                <el-input v-model="searchData.keyWord" placeholder="手机号、研究编号、姓名首字母"></el-input>
            </el-form-item>
            <div class="flex-r-but">
                <el-button plain type="info"    @click="GootherRecord" class=" pd-bt">转组档案</el-button>
                <el-button type="primary" @click="researchFun"  tyle="margin-left: 10px" class="  pd-bt">查询
                </el-button>
                <el-button type="success" class="pd-bt" style="margin-left: 10px" @click="handleAdd">添加</el-button>
                <el-button v-if="RoleGroup < 3" type="danger" @click="outPut" class="mg-lr-20 pd-bt"
                        >导出</el-button
                        >

            </div>
        </el-form>

        <!---->
        <template>
            <el-table
                    :data="tableData"
                    border
                    v-loading="loading"
                    element-loading-text="加载中"
                    @sort-change="sortChange"
                    style="width: 100%">
                <!--<el-table-column align="center" label="序号" width="70">-->
                    <!--<template  slot-scope="scope">-->
                        <!--{{scope.$index+1}}-->
                    <!--</template>-->
                <!--</el-table-column>-->
                <el-table-column
                        prop="Surname"
                        align="center"
                        label="姓名首字母"
                        min-width="100">
                </el-table-column>
                <el-table-column
                        prop="Mobile"
                        label="手机号"
                        :formatter="mobileFilter"
                        align="center"
                        min-width="100">
                </el-table-column>
                <el-table-column
                        prop="ResearchNo"
                        label="研究编号"
                        align="center"
                        min-width="100">
                </el-table-column>
                <el-table-column
                        prop="CreateTime"
                        label="登记时间"
                        align="center"
                        min-width="160">
                </el-table-column>
                <el-table-column
                        prop="InPeriod"
                        label="入组时研究阶段"
                        :formatter="PeriodFilter"
                        align="center"
                        sortable="custom"
                        min-width="170">
                </el-table-column>
                <el-table-column
                        prop="Period"
                        label="当前研究阶段"
                        :formatter="PeriodFilter"
                        align="center"
                        min-width="120">
                </el-table-column>
                <el-table-column
                        prop="InDistrictName"
                        :formatter="DistrictNameFilter"
                        label="入组时所在地区"
                        align="center"
                        min-width="160">
                </el-table-column>
                <el-table-column
                        prop="InCName"
                        label="入组时所在社区"
                        align="center"
                        min-width="160">
                </el-table-column>
                <el-table-column
                        prop="DistrictName"
                        :formatter="DistrictNameFilter"
                        label="当前所在地区"
                        align="center"
                        min-width="140">
                </el-table-column>
                <el-table-column
                        prop="CName"
                        label="当前所在社区"
                        align="center"
                        min-width="140">
                </el-table-column>
                <el-table-column
                        prop="GroupType"
                        label="研究组别"
                        :formatter="GroupTypeFilter"
                        align="center"
                        min-width="100">
                </el-table-column>
                <el-table-column
                        prop="InIntensityOfIntervention"
                        label="入组时干预强度"
                        :formatter="InIntensityFilter"
                        sortable="custom"
                        align="center"
                        min-width="180">
                </el-table-column>
                <el-table-column
                        prop="IntensityOfIntervention"
                        label="产前干预强度"
                        :formatter="IntensityFilter"
                        align="center"
                        min-width="120">
                </el-table-column>
                <el-table-column
                        prop="ChildIntensityOfIntervention"
                        :formatter="IntensityFilter"
                        label="当前儿童干预强度"
                        align="center"
                        min-width="160">
                </el-table-column>
                <el-table-column
                        prop="ChildBirthDate"
                        label="分娩日期"
                        align="center"
                        min-width="120">
                </el-table-column>
                <el-table-column
                        prop="UserState"
                        label="对象状态"
                        align="center"
                        :formatter="UserStateFilter"
                        min-width="120">
                </el-table-column>
                <el-table-column
                        fixed="right"
                        min-width="100"
                        align="center"
                        label="操作">
                    <template  slot-scope="scope">
                        <el-button size="small" type="text" label="查看"  @click="handleEdit(scope.$index, scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </template>
        <!--分页-->
        <div class="block mg-20-auto pagination-fixed">
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page.sync="pageId"
                    :page-sizes="[10, 20, 30, 40]"
                    :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total">
            </el-pagination>
        </div>
        <!--添加研究对象  oneStep-->
        <el-dialog title="添加研究对象" :visible.sync="dialogForm1" :append-to-body="true" top="0" width="60%"
                   :close-on-click-modal="false" >
            <el-form :model="addForm1" :rules="rules1" ref="addForm1" label-width="140px" class="demo-ruleForm">
                <el-form-item label="姓名首字母" prop="Surname">
                    <el-input v-model="addForm1.Surname" placeholder="请输入姓名首字母，最多四位"></el-input>
                </el-form-item>
                <!--<el-form-item label="名" prop="Name">-->
                    <!--<el-input v-model="addForm1.Name"></el-input>-->
                <!--</el-form-item>-->
                <el-form-item label="手机号" prop="Mobile">
                    <el-input v-model="addForm1.Mobile"></el-input>
                </el-form-item>
                <el-form-item label="研究编号" prop="ResearchNo">
                    <el-input v-model="addForm1.ResearchNo" onpaste="return false;"></el-input>
                </el-form-item>
                <el-form-item label="研究编号" prop="inputForm">
                    <el-input v-model="addForm1.inputForm"   placeholder="请再输入一遍" onpaste="return false;"></el-input>
                </el-form-item>
                <el-form-item label="研究阶段" prop="Period">
                    <el-select v-model="addForm1.Period" placeholder="请选择">
                        <el-option
                                v-for="item in options2"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="末次月经首日日期" prop="LastMenseDate" v-if="addForm1.Period==2">
                    <el-date-picker
                            v-model="addForm1.LastMenseDate"
                            type="date"
                            @change="changeDate1"
                            :picker-options="pickerOptions1"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="预产期" prop="ExpectedDate" v-if="addForm1.Period==2">
                    <el-date-picker
                            v-model="addForm1.ExpectedDate"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="所在地区" prop="DistrictNo">
                    <el-select v-model="addForm1.DistrictNo" placeholder="请选择" @change="changeDisTwo" clearable>
                        <el-option
                                v-for="item in optionDiq"
                                :key="item.DistrictName"
                                :label="item.DistrictName"
                                :value="item.DistrictNo">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="所在社区" prop="CommunityId">
                    <el-select v-model="CommunityId" placeholder="入组时所在地区和社区一旦保存，不可修改" @change="Commuty">
                        <el-option
                                v-for="item in options1p"
                                :key="item.SYS_ID"
                                :label="item.CName"
                                :value="item">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="研究组别" prop="GroupType">
                    {{addForm1.GroupType |GroupType}}
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogForm1 = false">取 消</el-button>
                <el-button type="primary" @click="nextStep1('addForm1')">下一步</el-button>
            </div>
        </el-dialog>
        <!--健康状况录入体重-->
        <el-dialog title="录入体重相关信息" :visible.sync="dialogForm2" width="50%" :close-on-click-modal="false">

            <el-form :model="addForm2" :rules="rules2" ref="addForm2" label-width="160px" class="demo-ruleForm">
                <div class="clearfix">
                    <el-form-item label="研究对象身高(cm)"  prop="Height" class="pull-left-50">
                        <el-input v-model="addForm2.Height" type="number"></el-input>
                    </el-form-item>
                    <el-form-item label="测量时间" class="pull-right-50">
                        <el-date-picker
                                v-model="addForm2.HeightMeasureDate"
                                :disabled="true"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                </div>
                <div class="clearfix">
                    <el-form-item label="研究对象孕前体重(kg)" prop="PreWeight" class="pull-left-50" v-if="addForm1.Period==2">
                        <el-input v-model="addForm2.PreWeight" type="number"></el-input>
                    </el-form-item>
                    <el-form-item label="研究对象体重(kg)" prop="Weight" class="pull-left-50" v-else>
                        <el-input v-model="addForm2.Weight" type="number"></el-input>
                    </el-form-item>
                    <el-form-item label="测量时间" class="pull-right-50" prop="WeightMeasureDate">
                        <el-date-picker
                                v-model="addForm2.WeightMeasureDate"
                                type="date"
                                :clearable="false"
                                :picker-options="pickerOptions1"
                                :disabled="addForm1.Period==1"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                </div>
                <div class="clearfix">
                    <el-form-item label="体重数据来源" class="pull-left-50">
                        <el-select v-model="addForm2.WeightSource" placeholder="请选择">
                            <el-option
                                v-for="item in optionsRecorder"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </div>
 <!--                <div class="clearfix" style="margin:-10px 0 35px 0" v-if="addForm1.Period==2">
                    <el-checkbox v-model="addForm2.PreWeightSelf" class="pull-right">研究对象体重自测</el-checkbox>
                </div> -->
                <div class="clearfix">
                    <el-form-item label="研究对象丈夫身高(cm)"  class="pull-left-50">
                        <el-input v-model="addForm2.HusbandHeight" type="number"></el-input>
                    </el-form-item>
                    <el-form-item label="测量时间" class="pull-right-50">
                        <el-date-picker
                                v-model="addForm2.HusbandHeightMeasureDate"
                                type="date"
                                value-format="yyyy-MM-dd"
                                :picker-options="pickerOptions2"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                </div>
                <div class="clearfix">
                    <el-form-item label="研究对象丈夫体重(kg)"  class="pull-left-50">
                        <el-input v-model="addForm2.HusbandWeight" type="number"></el-input>
                    </el-form-item>
                    <el-form-item label="测量时间" class="pull-right-50">
                        <el-date-picker
                                v-model="addForm2.HusbandWeightMeasureDate"
                                type="date"
                                :picker-options="pickerOptions3"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                </div>
                <div class="clearfix">
                    <el-form-item label="体重数据来源" class="pull-left-50">
                        <el-select v-model="addForm2.HusbandWeightSource" placeholder="请选择">
                            <el-option
                                v-for="item in optionsRecorder"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </div>
            </el-form>
            <p class="nomalColor"><span v-if="addForm1.Period==2">注：研究对象当前处于怀孕期</span><span v-else>注：研究对象当前处于孕前期</span></p>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogForm2 = false">取 消</el-button>
                <el-button type="primary" @click="nextStep2('addForm2')">下一步</el-button>
            </div>
        </el-dialog>
        <!--健康状况pre-->
        <el-dialog title="研究对象健康状况" :visible.sync="dialogForm3" width="50%" class="user-health" :close-on-click-modal="false">
            <!--<GeminiScrollbar style="height: 60vh">-->
                <div style="margin-right: 0px;max-height: 60vh;overflow-y: auto">
                <div>
                    <div class="content" v-if="Step3">
                        <p class="p1">当研究对象具有以下健康现状时，请勾选</p>
                        <p class="p2">研究对象<span v-if="addForm1.Period==2">孕前BMI= <i class="bmi-span" :class="{isRed:(womanBmi2>=24 ||womanBmi2<18.5)}">{{womanBmi2}}</i></span><span v-else>BMI=  <i class="bmi-span" :class="{isRed:(womanBmi1>=24 ||womanBmi1<18.5)}">{{womanBmi1}}</i></span>，研究对象丈夫BMI= <i class="bmi-span" :class="{isRed:(manBmi>=28)}">{{manBmi}}</i><i class="el-icon-edit" @click="editorBmi"></i></p>
                        <el-checkbox-group
                                size="medium"
                                :border="trueRadio"
                                v-model="checkeditems">
                            <el-checkbox v-for="item in items" size="medium"
                                         :label="item" :key="item.SYS_ID">{{item.ItemName}}</el-checkbox>
                        </el-checkbox-group>
                    </div>
                    <div class="content" v-else>
                        <p class="p2 ">您输入了以下健康信息，请再次核对：</p>
                        <p class="p1">研究对象<span v-if="addForm1.Period==2">孕前BMI=<i class="bmi-span" :class="{isRed:(womanBmi2>=24 ||womanBmi2<18.5)}">{{womanBmi2}}</i></span><span v-else>BMI=<i class="bmi-span" :class="{isRed:(womanBmi1>=24 ||womanBmi1<18.5)}">{{womanBmi1}}</i></span>，研究对象丈夫BMI= <i class="bmi-span" :class="{isRed:(manBmi>=28)}">{{manBmi}}</i></p>
                        <ul style="margin-top: 30px;">
                            <li v-for="(lab,index) in ckeckLabels" :key="index*3.3">
                                <i class="el-icon-info"></i>{{lab}}
                            </li>
                        </ul>
                        <h3 class="p2 " v-if="ckeckLabels.length<=0">未勾选任何危险因素</h3>
                    </div>
                    <p v-if="!Step3" class="sop">若以上信息核对无误，请点击【确认】，若信息有误，请点击【取消】并及时更正。</p>
                    <div slot="footer" class="dialog-footer">
                        <span v-if="Step3">
                            <el-button @click="dialogForm3 = false">取 消</el-button>
                            <el-button type="primary" @click="nextLoad">下一步</el-button>
                        </span>

                        <span v-else>
                            <el-button @click="Step3 = true">取 消</el-button>
                            <el-button type="primary" @click="nextStep3">确认</el-button>
                        </span>
                    </div>
                </div>
                    </div>
                <!--</GeminiScrollbar>-->
        </el-dialog>
    </div>
</template>
<script>
import {mapGetters} from 'vuex' 
import {DIC_PERIODA,filterPeriod} from '@/utils/localDic'
export default {
    data() {
        var  isvalidUserphone = (rule, value, callback) => {
            if(!value){
                callback(new Error('请输入手机号'))
            }
            else if (!(/^1[2|3|4|5|6|7|8|9][0-9]{9}$/).test(value)) {
                callback(new Error('请输入正确的手机号'))
            } else {
                callback()
            }
        }
        var isSUrename=(rule, value, callback) =>{
            if(!value){
                callback(new Error('请输入姓名'))
            }
            else if (!(/^[a-zA-Z]{1,4}$/).test(value)) {
                callback(new Error('请输入姓名首字母，最多四位'))
            } else {
                callback()
            }
        }
        var validateYanj1 = (rule, value, callback) => {
            if (value === '') {
                callback(new Error('必填项'));
            }
            else if(!(/^[a-zA-Z0-9]+$/).test(value)){
                callback(new Error('允许英文字母及数字'));
            }
            else {
                callback();
            }
        };
        var validateYanj2 = (rule, value, callback) => {
            if (value === '') {
                callback(new Error('请再次输入'));
            } else if (value !== this.addForm1.ResearchNo){
                callback(new Error('两次输入不一致!'));
            } else {
                callback();
            }
        };
        return {
            searchData:{
                sysId:'',
                period:'',
                communityId:'',
                isOver42:"",
                inPeriod:'',
                inIntensityOfIntervention:'',
                groupType:'',
                intensityOfIntervention:'',
	            childIntensityOfIntervention:'',
                userState:'',
                keyWord:'',
                districtNo:'',
                InDistrictNo:"",
                InCommunityId:"",
                comName:'',
                testType:'2',
            },
            timeDate:[],
            BirthtimeDate:[],
            activeName:'1',
            CommunityId:'',
            CtyIds:'',
            InCtyIds:'',
            optionDis:[],
            Step3:true,
            inputForm:'',
            maxHeight:'',
            defaultValue:['2018-08-01',new Date()],
            addForm1:{
                Surname:'',
                Name:'0',
                Mobile:'',
                ResearchNo:'',
                Period:'',
                LastMenseDate:'',
                ExpectedDate:'',
                CommunityId:'',
                GroupType:'',
                inputForm:'',
                DistrictNo:'',
                DistrictName:''
            },
            Inoptions1:[],
            rules1:{
                Surname:[
                    { validator: isSUrename, trigger: 'blur',required: true}
                ],
                Name:[
                    { required: true, message: '必填项', trigger: 'blur' }
                ],
                Mobile:[
                    { validator: isvalidUserphone, trigger: 'blur',required: true }
                ],
                ResearchNo:[
                    { validator: validateYanj1, trigger: 'blur',required: true,  }
                ],
                inputForm:[
                    { validator: validateYanj2, trigger: 'blur' }
                ],
                Period:[
                    { required: true, message: '必填项', trigger: 'blur' }
                ],
                LastMenseDate:[
                    { required: true, message: '必填项', trigger: 'blur' }
                ],
                ExpectedDate:[
                    { required: true, message: '必填项', trigger: 'blur' }
                ],
                CommunityId:[
                    { required: true, message: '必填项', trigger: 'blur' }
                ],
                DistrictNo:[
                    { required: true, message: '必填项', trigger: 'blur' }
                ],
            },
            addForm2:{
                SYS_ID:'',
                ResearchObjectId:'',
                Height:'',
                HeightMeasureDate:(new Date().getFullYear()+'-'+addZero((new Date().getMonth()+1))+'-'+addZero(new Date().getDate())),
                Weight:'',
                WeightMeasureDate:(new Date().getFullYear()+'-'+addZero((new Date().getMonth()+1))+'-'+addZero(new Date().getDate())),
                PreWeight:'',
                PreWeightMeasureDate:'',
                PreWeightSelf:false,
                HusbandHeight:'',
                HusbandHeightMeasureDate:'',
                HusbandWeight:'',
                HusbandWeightMeasureDate:'',
                WeightSource: '',
                HusbandWeightSource: '',
            },
            rules2:{
                Height:[ { required: true, message: '必填项', trigger: 'blur' }],
                Weight:[ { required: true, message: '必填项', trigger: 'blur' }],
                PreWeight:[ { required: true, message: '必填项', trigger: 'blur' }],
                WeightMeasureDate:[ { message: '必填项', trigger: 'blur' }],
            },
            tableData:[],
            pageId:1,
            total:null,
            showActive:true,
            loading:true,
            pageSize:10,
            dialogForm1:false,
            dialogForm2:false,  //体重
            dialogForm3:false,   //健康状况PRE
            trueRadio:true,
            checkeditems:[],
            ckeckIds:[],
            checkLabels:[],
            items:[],
            tmpValue: "",
            currentLevel: 1,
            currentValue: "",
            DistrictFullName: [],
            currentLabel: "",
            pickerOptions: {
                shortcuts: [{
                    text: '最近一周',
                    onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                    picker.$emit('pick', [start, end]);
                }
                }, {
                    text: '最近一个月',
                            onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近三个月',
                            onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                        picker.$emit('pick', [start, end]);
                    }
                }],
                disabledDate:function(val){
                    if(val>new Date())return true
                }
            },
            pickerOptions1:{
                disabledDate:function(val){
                    if(val>new Date())return true
                }
            },
            pickerOptions2:{
                disabledDate:function(val){
                    if(val>new Date())return true
                }
            },
            pickerOptions3:{
                disabledDate:function(val){
                    if(val>new Date())return true
                }
            },
            options1: [],
            parentDistrictNo: "",
            DistrictFullName: [],
            item: null,
            options11:[],
            options2spyd: [{value: '', label: '全部'},{value: '1', label: '孕前期'}, {value: '2', label: '怀孕期'}],
            options2sp: DIC_PERIODA,
            options2: [{value: '1', label: '孕前期'}, {value: '2', label: '怀孕期'}],
            options3: [{value: '', label: '全部'},{value: '1', label: 'A'}, {value: '2', label: 'B'}],
            options4: [{value: '', label: '全部'},{value: '1', label: 'AA'}, {value: '2', label: 'A'}],
            options5: [{value: '1', label: '活跃'},{value: '2', label: '不活跃'}, ],
            options6: [{value: '', label: '全部'},{value: '0', label: '预试验'},{value: '1', label: '正式试验'},{value: '2', label: '预试验+正式试验'}],
            optionsRecorder:  [{value: '3', label: '对象自测'},{value: '2', label: '机构测量'},{value: '1', label: '项目测量'}],
            mobileFilter(row, column, cellValue, index) {
                return cellValue.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
            },
            isJoinFilter(row, column, cellValue, index){
                return cellValue==1?'是':'否'
            },
            DistrictNameFilter(row, column, cellValue, index){
                return cellValue ||'-'
            },
            PeriodFilter(row, column, cellValue, index){
            	return filterPeriod(cellValue)
            },
            InIntensityFilter(row, column, cellValue, index){
                if(cellValue==undefined){
                    row.InIntensityOfIntervention=''
                }
                if(cellValue=='1'){
                    return 'AA'
                }
                else if(cellValue=='2'){
                    return 'A'
                }
                else{
                    return '-'
                }
            },
            IntensityFilter(row, column, cellValue, index){
                if(cellValue=='1'){
                    return 'AA'
                }
                else if(cellValue=='2'){
                    return 'A'
                }
                else{
                    return '-'
                }
            },
            GroupTypeFilter(row, column, cellValue, index){
                return cellValue=='1'?'A':'B'
            },
            optionDiq:[],
            options1p:[],
            clickOff:false,
            sort1:'',
            sort2:''

        }
    },
    watch:{
        'addForm1.Surname':function(val){
            this.addForm1.Surname=val.toUpperCase()
        }
    },
    beforeMount:function() {
        // let that=this;
        // let appHeight=$(window).height();
        // let autoheight=(appHeight-290)+'px'
        // that.maxHeight=autoheight
    },
    computed:{
        womanBmi1:function () {
            return computedBIM(this.addForm2.Weight, this.addForm2.Height)
        },
        womanBmi2:function () {
            return computedBIM(this.addForm2.PreWeight, this.addForm2.Height)
        },
        manBmi:function () {
            return computedBIM(this.addForm2.HusbandWeight, this.addForm2.HusbandHeight)
        },
        ...mapGetters([
            'resechObj',
            'userIcon',
            'token',
            'RoleGroup',
            'UserDic'
        ])
    },
    methods: {
        outPut() {
        //导出数据
            var that = this
             window.open(
                window.origin +
                "/API/105/" +
                `ExportResearchObjectHandler.ashx?pageCount=${that.pageId-1}&pageSize=${that.pageSize}&period=${that.searchData.period}&communityId=${that.searchData.communityId}&isOver42=${that.searchData.isOver42}&inPeriod=${that.searchData.inPeriod}&inIntensityOfIntervention=${that.searchData.inIntensityOfIntervention}&groupType=${that.searchData.groupType}&intensityOfIntervention=${that.searchData.intensityOfIntervention}&childIntensityOfIntervention=${that.searchData.childIntensityOfIntervention}&userState=${that.searchData.userState}&keyWord=${that.searchData.keyWord}&districtNo=${that.searchData.districtNo}&InDistrictNo=${that.searchData.InDistrictNo}&InCommunityId=${that.searchData.InCommunityId}&comName=${that.searchData.comName}&testType=${that.searchData.testType}&sort1=${that.sort1}&sort2=${that.sort2}&startDate=${that.timeDate?that.timeDate[0]:''}&endDate=${that.timeDate?that.timeDate[1]:''}&startBirthDate=${(that.BirthtimeDate && that.BirthtimeDate.length >0 )?that.BirthtimeDate[0]:''}&endBirthDate=${(that.BirthtimeDate && that.BirthtimeDate.length >0 )?that.BirthtimeDate[1]:''}`
            );
        
        },
        sortChange(colum){
            let that=this;
            if(colum.prop=='InPeriod'){
                if(colum.order=='ascending'){
                    that.sort1='ASC'
                }
                else{
                    that.sort1='DESC'
                }
                that.sort2=''
            }
            else if(colum.prop=='InIntensityOfIntervention'){
                if(colum.order=='ascending'){
                    that.sort2='ASC'
                }
                else{
                    that.sort2='DESC'
                }
                that.sort1=''
            }
            that.getList()
        },
        changeDis:function(val){   //选择地区
            this.CtyIds=''
            this.searchData.communityId=''
            this.options1 = [];
            if(val){
                this.getComselectList()
            }
        },
        InchangeDis:function(val){   //选择地区
            this.InCtyIds=''
            this.searchData.InCommunityId=''
            this.Inoptions1 = [];
            if(val){
                this.IngetComselectList()
            }
        },
        GootherRecord:function(){  //转组档案
            this.$router.push({
                path:'/participant/changePeriod'
            })
        },
        changeDisTwo:function(val){
           this.CommunityId=''
           if(val!=''){
               this.addForm1.DistrictName= this.optionDiq.find((vals)=>{
                   if(vals.DistrictNo==val){
                       return vals
                   }
               }).DistrictName||''
               this.addForm1.CommunityId=''
               this.getAddformlist()
           }
           else{
               this.addForm1.CommunityId=''
               this.options1p=[]
           }

        },
        handleItemChange(value, callback) {
            this.handleChange(value, callback);
        },
        findItem(value) {
            return this.tmpValue == value.DistrictNo;
        },
        findValueByLabel(option) {
            return this.currentLabel == option.DistrictName;
        },
        handleChange(value, callback) {
            this.currentValue = value;
            this.tmpValue = value[0];
            this.parentDistrictNo = value[value.length - 1];
            if (value.length == 1) {
                this.item = this.optionDis.find(this.findItem);
            } else if (value.length == 2) {
                let tmpItem = this.optionDis.find(this.findItem);
                this.tmpValue = value[1];
                this.item = tmpItem.children.find(this.findItem);
            } else if (value.length == 3) {
                let tmpItem = this.optionDis.find(this.findItem);
                this.tmpValue = value[1];
                let item = tmpItem.children.find(this.findItem);
                this.tmpValue = value[2];

                this.item = item.children.find(this.findItem);
            }

            this.DistrictFullName[value.length - 1] = this.item.label;

            if (value.length >= 3) {
                return false;
            }

            this.getDistricts(2, this.item, callback);
        },
        setDefaultValue(nameArray, DistrictFullNo) {
            // 获取省市的编码
            let provinceNo = DistrictFullNo.substring(0, 2);
            let cityNo = DistrictFullNo.substring(0, 4);
            // 获取当前的Label
            this.currentLabel = nameArray[0];
            this.tmpValue = provinceNo;
            // 获取省的item
            let disNo1 = this.optionDis.find(this.findItem);

            let provinceArr = new Array(provinceNo);

            let valueArr = new Array(disNo1.value);
            let cityArr = new Array(provinceNo, cityNo);

            // this.parentDistrictNo = disNo1.value;

            let getCitys = () => {
                // setTimeout(() => {
                this.handleChange(cityArr);
                // }, 0);
            };

            this.handleChange(provinceArr, getCitys);
            this.form.DistrictFullNo = new Array(provinceNo, cityNo, DistrictFullNo);
        },
        getDistricts(type, item, callback) {
            let that = this;
            let parentDistrictNo = that.parentDistrictNo;
            that.service({
                url: "dic/GetDistrict?parentDistrictNo=" + that.parentDistrictNo,
                method: "get",
                params: {}
            }).then(resp => {
                let tmpArr = [];
                if (!resp.dtData || resp.dtData.length <= 0) {
                    return;
                }
                let children = [];
                if (that.currentValue.length >= 2) {
                    children = null;
                }
                resp.dtData.forEach(pic => {
                    pic.value = pic.DistrictNo;
                    pic.label = pic.DistrictName;
                    pic.children = children;
                    tmpArr.push(pic);
                });
                if (type == 1) {
                    that.optionDis = tmpArr;
                } else if (type == 2) {
                    // that.$set(item, "children", tmpArr);
                    item.children = tmpArr;
                } else if (type == 3) {
                    return tmpArr;
                }
                if (callback) {
                    callback();
                }
            }).catch(data => {
                console.log(data);
                that.loading = false;
            });
        },
        // 添加研究对象
        handleAdd() {
            let that=this;
            that.CommunityId=''
            that.dialogForm1 = true;
            that.$nextTick(function(){
                that.$refs.addForm1.resetFields();
            })
        },
        UserStateFilter(row, column, cellValue, index){
            switch (cellValue){
                case '1':
                    return '活跃'
                    break;
                case '2':
                    return '不活跃'
                    break;
                case '3':
                    return '不活跃'
                    break;
                case '4':
                    return '不活跃'
                    break;
                case '5':
                    return '不活跃'
                    break;
            }
        },
        changeDate1:function(val){  //末次月经时间改变
            let that=this;
            let newdata=new Date(val)    //计算预产期
            that.addForm1.ExpectedDate=dateForm(newdata.setMonth(newdata.getMonth()+9,newdata.getDate()+7))
        },
        handleSizeChange(val) {       //条数改变
            this.pageSize=val;
            this.getList()
        },
        handleCurrentChange(val) {    //页数改变
            this.pageId = val
            this.getList()
        },
        handleEdit:function(index,row){  //查看
            let that=this;
            that.addForm1=JSON.parse(JSON.stringify(row))
            that.addForm2.ResearchObjectId=row.SYS_ID
            if(row.ConditionFillState=='1'&& row.GroupType=='1' && row.ConfirrmTime==undefined){
                that.$nextTick(function(){
                    that.$refs.addForm2.resetFields();
                })
                that.dialogForm2=true
                that.getHealth()
            }
            else if((row.ConditionFillState=='2' ||row.ConditionFillState=='3')&& row.GroupType=='1'&& row.ConfirrmTime==undefined){
                that.dialogForm3=true
                that.getHealth()
                that.ckeckLabels=[]
                that.Step3=true;
                that.checkeditems=[]
                that.service({
                    url:'/ResearchObject/GetParticipantDetail',
                    method:'get',
                    params:{
                        itemType:'2',
                        sysId:'',
                        mobile:row.Mobile,
                        Period:'',
                        researchNo:row.ResearchNo,
                        ResearchObjectId:row.SYS_ID,
                        pageCount:0,
                        pageSize: 100,
                    }
                }).then(response=>{
                    response.dtData.dtHeightAndWeight.length>0?that.addForm2=response.dtData.dtHeightAndWeight[0]:''
                }).catch(data=>{
                })
            }
            else if(row.ConditionFillState=='4'|| row.GroupType=='2' ||row.ConfirrmTime!==undefined){
                that.$router.push({
                    path:'/participant/editor',
                    query:{
                        id:row.SYS_ID,
                        mobile:row.Mobile,
                        researchNo:row.ResearchNo
                    }
                })
            }
        },
        nextStep1:function(formName){ //下一步  添加研究对象
            let that=this;
            that.$nextTick(function(){
                that.$refs.addForm2.resetFields();
            })
            that.$refs[formName].validate((valid) => {
                if (valid) {
                delete that.addForm1.inputForm
                // 去掉初筛功能后，初筛编号默认传0，否则会保存失败
                that.addForm1.FirstScreenId = 0;
                // 默认用户状态为活跃
                that.addForm1.UserState = 1;
                    that.service({
                        url: "/ResearchObject/SaveResearchObject",
                        method: "post",
                        data: {
                                ...that.addForm1,

                         }
                        }).then(response => {
                                that.dialogForm1=false
                                that.$message({
                                    type:'success',
                                    message:response.msg
                                })
                                that.loading = false;
                                that.addForm1.inputForm='';
                                that.addForm2.ResearchObjectId=response.result
                                if(that.addForm1.GroupType=='2'){  //如果是常规护理组
                                    that.dialogForm1=false;
                                    let mobile=that.addForm1.Mobile;
                                    that.$alert(`<h3>成功保存研究对象！</h3><p>研究对象可下载APP，用手机号${mobile}完成注册并登录使用。</p>`, '提示', {
                                        dangerouslyUseHTMLString: true
                                    });
                                }
                                else{
                                    that.dialogForm2=true;
                                    that.getHealth()
                                }
                                that.getList()
                            }).catch(data => {
                                that.addForm1.inputForm=''
                                that.loading = false;
                        });
                }
                else {
                    return false;
                }
            });
        },
        nextStep2:function(formName){ //下一步   录入体重健康信息
            let that=this
            that.$refs[formName].validate((valid) => {
                if (valid) {
                    that.addForm2.WeightSource=='3'?that.addForm2.PreWeightSelf=true:''
                    that.service({
                        url: "/ResearchObject/SaveHealthConditionOne",
                        method: "post",
                        data: {
                                ...that.addForm2,
                        }
                    }).then(response => {
                        that.dialogForm2=false
                        that.dialogForm3=true
                        that.getList()
                    }).catch(data => {});
                }
                else {
                    return false;
                    }
                });
        },
        nextStep3:function(){   //下一步，确认发送短信
            let that=this;
            if(that.clickOff){
                return false
            }
            that.clickOff=true
            that.service({
                url: "/ResearchObject/SaveHealthConditionTwo",
                method: "post",
                data: {
                    ResearchObjectId:that.addForm2.ResearchObjectId,
                    ListHealthConditionTwoObj:(that.ckeckIds.length==0)?[]:that.ckeckIds,
                    IntensityOfIntervention:that.ckeckIds.length>0?'1':'2',
	                OparatorId:JSON.parse(that.UserDic).SYS_ID,
	                Period:that.addForm1.Period,
	                Oparator:that.userIcon,
                }}).then(response => {
                that.service({
                        url: "/ResearchObject/ConfirmResearchObject",
                        method: "post",
                        params: {
                            sysId:that.addForm2.ResearchObjectId,
                            mobile:that.addForm1.Mobile,
                            opUserCode:that.userIcon   //修改人员账号

                        }}).then(response => {
                            that.clickOff=false
                            that.dialogForm3=false
                                let mobile=that.addForm1.Mobile;
                                that.$alert(`<h3>成功保存研究对象！</h3><p>研究对象可下载APP，用手机号${mobile}完成注册并登录使用。</p>`, '提示', {
                                    dangerouslyUseHTMLString: true
                                });
                                that.getList()
                            }).catch(data => {
                    that.clickOff=false

                    });
                       // that.getList()
                    }).catch(data => {
                that.clickOff=false
            });

        },
        nextLoad:function(){   //计算
            let that=this;
            let checkList=that.checkeditems;
            that.ckeckIds=[];
            that.ckeckLabels=[];
            for(let item of checkList){
                let obj={
                    ResearchObjectId:that.addForm2.ResearchObjectId,
                    ItemId:item.SYS_ID,
                    IsSelected:'1',
	                ItemName:item.ItemName,
                    ConfirmDate:dateForm(new Date()),
                    Oparator:that.userIcon,
                    OparatorId:that.token,
                    UpdateDate:dateForm(new Date())
                }
                that.ckeckIds.push(obj)
                that.ckeckLabels.push(item.ItemName)
            }
            that.dialogForm2=false
            that.dialogForm3=true
            that.Step3=false;
        },
        editorBmi:function(){   //健康状况pre 编辑体重
            let that=this;
            that.dialogForm2=true;
        },
        getHealth:function(){    //获取健康状况list
            let that = this;
            that.service({
                url: "/Dic/GetHealthConditionItem",
                method: "get",
                params: {
                    userType: that.addForm1.Period,
                    pageCount:0,
                    pageSize: 100,
                }
            })
            .then(response => {
                that.items=response.dtData
            })
            .catch(data => {

            });
        },
        GetCommunityDistrict:function(){    //获取社区行政区
            let that = this;
            that.service({
                url: "/Dic/GetCommunityDistrict",
                method: "get",
                params: {
                }
            }).then(response => {
                that.optionDiq=response.dtData;
            })
            .catch(data => {

            });
        },
        researchFun:function(){      //查询，简单存储查询条件
            this.pageId=1;
            this.pageSize=10;
            this.total=null;
            this.getList()
            let storageObj=this.searchData
            storageObj.BirthtimeDate = this.BirthtimeDate || []
            this.searchData.comName=this.CtyIds;
            localStorage.setItem('participantA5',JSON.stringify(storageObj))
        },
        getList:function(){           //获取一级信息列表
            let that=this
            console.log(that.BirthtimeDate)
            that.service({
                url:'/ResearchObject/GetResearchObjectList',
                method:'get',
                params:{
                    pageCount:(that.pageId-1),
                    pageSize:that.pageSize,
                    ...that.searchData,
                    sort1:that.sort1,
                    sort2:that.sort2,
                    startDate:that.timeDate?that.timeDate[0]:'',
                    endDate:that.timeDate?that.timeDate[1]:'',
                    startBirthDate:(that.BirthtimeDate && that.BirthtimeDate.length >0 )?that.BirthtimeDate[0]:'',
                    endBirthDate:(that.BirthtimeDate && that.BirthtimeDate.length >0 )?that.BirthtimeDate[1]:'',
                }
            }).then(response=>{
                console.log(response)
                that.tableData=response.dtData;
                that.total =parseInt(response.dtData[0].TotalCount);
                that.loading=false
            }).catch(data=>{
                that.loading=false
            })
        },
        async getComselectList(){   //获取社区信息
            let that = this;
            await that.service({
                url: "dic/GetCommunity",
                method: "get",
                params: {
                    cName: "",
                    cGroup: "",
                    districtNo:that.searchData.districtNo||'',
                    pageCount:0,
                    pageSize: 100,
                }
            }).then(resp => {
                let obj={
                    CGroup:'',
                    Code:'',
                    SYS_ID:'',
                    CName:'全部'
                }
                if(that.searchData.districtNo && that.searchData.districtNo!=''){
                	 that.options1=resp.dtData
                }
               	else{
               		 that.options1=[]
               	}
            }).catch(data => {

            });
        },
        async IngetComselectList(){   //获取社区信息
            let that = this;
            await that.service({
                url: "dic/GetCommunity",
                method: "get",
                params: {
                    cName: "",
                    cGroup: "",
                    districtNo:that.searchData.InDistrictNo||'',
                    pageCount:0,
                    pageSize: 100,
                }
            }).then(resp => {
                let obj={
                    CGroup:'',
                    Code:'',
                    SYS_ID:'',
                    CName:'全部'
                }
                if(that.searchData.InDistrictNo && that.searchData.InDistrictNo!=''){
                	 that.Inoptions1=resp.dtData
                }
               	else{
               		 that.Inoptions1=[]
               	}
            }).catch(data => {

            });
        },
        getAddformlist:function(){
            let that = this;
            that.service({
                url: "dic/GetCommunity",
                method: "get",
                params: {
                    cName: "",
                    cGroup: "",
                    districtNo:that.addForm1.DistrictNo||'',
                    pageCount:0,
                    pageSize: 100,
                }
            }).then(resp => {
                that.options1p=resp.dtData
            }).catch(data => {

            });
        },
        Commuty:function(val){
            this.CommunityId=val.CName
            this.addForm1.CommunityId=val.SYS_ID
            this.addForm1.GroupType=val.CGroup
        },
        Commutysp:function(val){
            this.CtyIds=val.CName
            val.SYS_ID!==undefined?this.searchData.communityId=val.SYS_ID:this.searchData.communityId=''
        },
        InCommutysp:function(val){
            this.InCtyIds=val.CName
            val.SYS_ID!==undefined?this.searchData.InCommunityId=val.SYS_ID:this.searchData.InCommunityId=''
        }
    },
    async mounted(){
        let that=this;
        if(that.$route.query.Surname!==undefined){
            that.addForm1=that.$route.query
            that.dialogForm1=true
        }
        that.timeDate= [
            '2018-06-01',
            (new Date().getFullYear()+'-'+addZero((new Date().getMonth()+1))+'-'+addZero(new Date().getDate())),
        ];   //初始化时间范围
        JSON.parse(localStorage.getItem('participantA5'))?
	        that.searchData=JSON.parse(localStorage.getItem('participantA5')):''
        that.BirthtimeDate=that.searchData.BirthtimeDate || [];
        // that.getComselectList()  // 取消获取全部社区的请求
        that.$store.commit('SET_RESECHOBJ',{})
        that.GetCommunityDistrict()
        that.searchData.districtNo=JSON.parse(that.UserDic).DistrictNo||that.searchData.districtNo||''
        if(JSON.parse(that.UserDic).IsCommunityOnly=='1'){
             await that.getComselectList()
             that.searchData.communityId=JSON.parse(that.UserDic).CommunityId||''
	         if(that.searchData.communityId){
		         that.CtyIds=that.options1.find(val=>{
			         return val.SYS_ID==JSON.parse(that.UserDic).CommunityId
		         }).CName||''
	         }
        }
        else{
            await that.getComselectList()
            that.searchData.communityId=(JSON.parse(localStorage.getItem('participantA5'))||{}).communityId ||''
            that.CtyIds=(that.options1.find(val=>{
                return val.SYS_ID==that.searchData.communityId
            })||{}).CName||''
        }
        console.log(that.RoleGroup)
	    if(that.RoleGroup=='7' || that.RoleGroup=='8'){
		    console.log(that.RoleGroup)
		    that.searchData.period='3'
	    }
        that.getList()
    },
    created:function(){
        if(this.RoleGroup==5){             //未知bug
            for(let item in this.searchData){
                if(item=='intensityOfIntervention'){
                    this.searchData.intensityOfIntervention='1'
                }

            }
        }
    },
    filters:{
        GroupType:function(val){
           if(val==''||val==undefined){
               return ''
           }
           return  val==1?'A':'B'
        }
    }
  }
function computedBIM(w,h){   //计算BMI
    return isNaN(parseFloat(w)/((parseFloat(h)/100)*(parseFloat(h)/100)))?'-':(parseFloat(w)/((parseFloat(h)/100)*(parseFloat(h)/100))).toFixed(1)
}
function addZero(s){
    return s < 10 ? '0' + s: s;
}
function dateForm(data){
    return   new Date(data).getFullYear()+'-'+addZero((new Date(data).getMonth()+1))+'-'+addZero(new Date(data).getDate())
}
</script>
<style scoped lang="scss">
   .content{
       margin:0px;
       .p1{
           color:#ccc;
           text-align: center;
           font-size: 15px;
           margin-top: 10px;
       }

       .p2{
           text-align: center;
           margin-top: 5px;
           i{
               cursor: pointer;
               padding:0 10px;
           }
       }
        ul{
            li{
                margin:10px;
                font-size:16px;
                line-height:1.5;
                i{
                    color: #409EFF;
                    padding-right: 10px;
                }
            }
        }
   }
   .sop{
       margin:15px;
   }
   .foot-pos{
       position: absolute;
       bottom: 20px;
       left: 15px;

   }
   .item-right{
       margin-right: 15px;
   }
   .fade-enter-active, .fade-leave-active {
       transition: opacity .4s;
   }
   .fade-enter, .fade-leave-to{
       opacity: 0;
   }
   .bmi-span{
       color: #666;
       font-size: 16px;
       padding-left: 5px;
       font-weight:bolder;
       font-style: normal;
   }
   .isRed{color: red !important;}
   .pagination-fixed{
    position: static;
   }
</style>
